home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / ctask.zip / TSKALLOC.C < prev    next >
C/C++ Source or Header  |  1988-07-01  |  865b  |  49 lines

  1. /*
  2.    TSKALLOC.C - CTask - Dynamic memory allocation interface
  3.  
  4.    Public Domain Software written by
  5.       Thomas Wagner
  6.       Patschkauer Weg 31
  7.       D-1000 Berlin 33
  8.       West Germany
  9.  
  10.    This file is new with Version 1.1
  11.  
  12.    This module contains the memory allocation functions that are needed
  13.    if TSK_DYNAMIC is defined.
  14.  
  15. */
  16.  
  17. #include "tsk.h"
  18.  
  19. #if (TURBO)
  20. #include <alloc.h>
  21. #else
  22. #include <malloc.h>
  23. #endif
  24.  
  25. #define xalloc(size) malloc (size)
  26. #define xfree(item)  free (item)
  27.  
  28. resource alloc_resource;
  29.  
  30. farptr tsk_alloc (word size)
  31. {
  32.    farptr ptr;
  33.  
  34.    request_resource (&alloc_resource, 0L);
  35.    ptr = xalloc (size);
  36.    release_resource (&alloc_resource);
  37.  
  38.    return ptr;
  39. }
  40.  
  41.  
  42. void tsk_free (farptr item)
  43. {
  44.    request_resource (&alloc_resource, 0L);
  45.    xfree (item);
  46.    release_resource (&alloc_resource);
  47. }
  48.  
  49.